{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "from unicodedata import normalize\n",
    "from tensorflow import keras\n",
    "import os\n",
    "from tensorflow.keras.models import Sequential, load_model, clone_model\n",
    "from tensorflow.keras.optimizers import RMSprop\n",
    "from collections import Counter\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from matplotlib import pyplot as plt\n",
    "from tensorflow.keras.layers import Conv2D, ZeroPadding2D, AveragePooling2D, BatchNormalization, Activation, Dense, \\\n",
    "    Input, MaxPooling2D,Flatten,Dropout\n",
    "from tensorflow.keras import Model, layers, regularizers\n",
    "import tensorflow.keras.backend as K\n",
    "from tensorflow.keras.datasets import cifar10\n",
    "from tensorflow.keras.callbacks import LearningRateScheduler, ModelCheckpoint, EarlyStopping, ReduceLROnPlateau\n",
    "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
    "from tensorflow.keras.initializers import he_normal\n",
    "from tensorflow.keras import optimizers\n",
    "from sklearn.preprocessing import MinMaxScaler\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn import preprocessing\n",
    "from sklearn.metrics import accuracy_score\n",
    "from tqdm import tqdm\n",
    "import csv\n",
    "import cv2\n",
    "#importing model \n",
    "from tensorflow.keras.applications import ResNet50,densenet,VGG16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "f = csv.reader(open('../../data/data_set/BIT_label.csv','r',encoding='utf-8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_data = []\n",
    "Y_data = []\n",
    "input_shape=(32,32,3)#3通道图像数据\n",
    "for lists in f:\n",
    "    img = cv2.imread('../../data/data_set/BIT/'+lists[1])\n",
    "    img = cv2.resize(img, (input_shape[0], input_shape[1]))\n",
    "    X_data.append(img)\n",
    "    Y_data.append(int(lists[2]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_class = 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_x,test_x,train_y,test_y = train_test_split(X_data,Y_data,test_size=0.4)\n",
    "train_x = np.array(train_x).astype('float32') / 255.\n",
    "train_y = np.array(train_y)\n",
    "test_x = np.array(test_x).astype('float32') / 255.\n",
    "test_y = np.array(test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_x_mean = np.mean(train_x, axis=0)\n",
    "test_x_mean = np.mean(test_x, axis=0)\n",
    "train_x -= train_x_mean\n",
    "test_x -= test_x_mean"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "lb = preprocessing.LabelBinarizer().fit(np.array(range(num_class)))  # 对标签进行ont_hot编码\n",
    "train_y = lb.transform(train_y)  # 因为是多分类任务，必须进行编码处理\n",
    "test_y = lb.transform(test_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "def vgg16():\n",
    "    input_tensor = Input(shape=(32, 32, 3))\n",
    "    x = input_tensor\n",
    "    x = Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv1')(input_tensor)\n",
    "    x = Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv2')(x)\n",
    "    x = MaxPooling2D((2, 2), strides=(2, 2), name='block1_pool')(x)\n",
    "#     print(x.shape)\n",
    "    # Block 2\n",
    "    x = Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv1')(x)\n",
    "    x = Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv2')(x)\n",
    "    x = MaxPooling2D((2, 2), strides=(2, 2), name='block2_pool')(x)\n",
    "#     print(x.shape)\n",
    "    # Block 3\n",
    "    x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv1')(x)\n",
    "    x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv2')(x)\n",
    "    x = Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv3')(x)\n",
    "    x = MaxPooling2D((2, 2), strides=(2, 2), name='block3_pool')(x)\n",
    "#     print(x.shape)\n",
    "    # Block 4\n",
    "    x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv1')(x)\n",
    "    x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv2')(x)\n",
    "    x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv3')(x)\n",
    "    x = MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool')(x)\n",
    "#     print(x.shape)\n",
    "    # # Block 5\n",
    "    # x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv1')(x)\n",
    "    # x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv2')(x)\n",
    "    # x = Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv3')(x)\n",
    "    # x = MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool')(x)\n",
    "    # print(x.shape)\n",
    "\n",
    "    # Classification block\n",
    "    x = Flatten(name='flatten')(x)\n",
    "    x = Dense(4096, activation='relu', name='fc1')(x)\n",
    "    x = Dense(4096, activation='relu', name='fc2')(x)\n",
    "    x = Dropout(0.5)(x)\n",
    "    x = Dense(6, activation='softmax', name='predictions')(x)\n",
    "    model = Model(inputs=input_tensor, outputs=x, name='VGG16')\n",
    "    return model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"VGG16\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "input_2 (InputLayer)         [(None, 32, 32, 3)]       0         \n",
      "_________________________________________________________________\n",
      "block1_conv1 (Conv2D)        (None, 32, 32, 64)        1792      \n",
      "_________________________________________________________________\n",
      "block1_conv2 (Conv2D)        (None, 32, 32, 64)        36928     \n",
      "_________________________________________________________________\n",
      "block1_pool (MaxPooling2D)   (None, 16, 16, 64)        0         \n",
      "_________________________________________________________________\n",
      "block2_conv1 (Conv2D)        (None, 16, 16, 128)       73856     \n",
      "_________________________________________________________________\n",
      "block2_conv2 (Conv2D)        (None, 16, 16, 128)       147584    \n",
      "_________________________________________________________________\n",
      "block2_pool (MaxPooling2D)   (None, 8, 8, 128)         0         \n",
      "_________________________________________________________________\n",
      "block3_conv1 (Conv2D)        (None, 8, 8, 256)         295168    \n",
      "_________________________________________________________________\n",
      "block3_conv2 (Conv2D)        (None, 8, 8, 256)         590080    \n",
      "_________________________________________________________________\n",
      "block3_conv3 (Conv2D)        (None, 8, 8, 256)         590080    \n",
      "_________________________________________________________________\n",
      "block3_pool (MaxPooling2D)   (None, 4, 4, 256)         0         \n",
      "_________________________________________________________________\n",
      "block4_conv1 (Conv2D)        (None, 4, 4, 512)         1180160   \n",
      "_________________________________________________________________\n",
      "block4_conv2 (Conv2D)        (None, 4, 4, 512)         2359808   \n",
      "_________________________________________________________________\n",
      "block4_conv3 (Conv2D)        (None, 4, 4, 512)         2359808   \n",
      "_________________________________________________________________\n",
      "block4_pool (MaxPooling2D)   (None, 2, 2, 512)         0         \n",
      "_________________________________________________________________\n",
      "flatten (Flatten)            (None, 2048)              0         \n",
      "_________________________________________________________________\n",
      "fc1 (Dense)                  (None, 4096)              8392704   \n",
      "_________________________________________________________________\n",
      "fc2 (Dense)                  (None, 4096)              16781312  \n",
      "_________________________________________________________________\n",
      "dropout_1 (Dropout)          (None, 4096)              0         \n",
      "_________________________________________________________________\n",
      "predictions (Dense)          (None, 6)                 24582     \n",
      "=================================================================\n",
      "Total params: 32,833,862\n",
      "Trainable params: 32,833,862\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model = vgg16()\n",
    "model.summary()#显示模型结构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "def scheduler(epoch):\n",
    "    if epoch < 80:\n",
    "        return 0.01\n",
    "    if epoch < 160:\n",
    "        return 0.005\n",
    "    return 0.001"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "sgd = optimizers.SGD(lr=0.1, momentum=0.9, nesterov=True)\n",
    "model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['acc'])\n",
    "\n",
    "change_lr = LearningRateScheduler(scheduler)\n",
    "\n",
    "save_dir = os.path.join(os.getcwd(), 'data/trained_model')\n",
    "model_name = 'vgg16_model.{epoch:02d}-{val_acc:.2f}.h5'\n",
    "if not os.path.isdir(save_dir):\n",
    "    os.makedirs(save_dir)\n",
    "filepath = os.path.join(save_dir, model_name)\n",
    "\n",
    "checkpoint = ModelCheckpoint(filepath=filepath,\n",
    "                             monitor='val_acc',\n",
    "                             verbose=1,\n",
    "                             save_best_only=True)\n",
    "\n",
    "#creating early stopping to prevent model from overfitting \n",
    "early_stopping = EarlyStopping(monitor=\"val_acc\", min_delta=0,\n",
    "                                                  patience=30, verbose=1, \n",
    "                                                  mode=\"auto\", baseline=None, \n",
    "                                                  restore_best_weights=True)\n",
    "\n",
    "cbks = [early_stopping, checkpoint, change_lr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using real-time data augmentation.\n"
     ]
    }
   ],
   "source": [
    "print('Using real-time data augmentation.')\n",
    "# datagen = ImageDataGenerator(horizontal_flip=True,\n",
    "#                              width_shift_range=0.125, height_shift_range=0.125, fill_mode='constant', cval=0.)\n",
    "datagen = ImageDataGenerator(featurewise_center=True,\n",
    "                                   rotation_range=20,\n",
    "                                   width_shift_range=0.2,\n",
    "                                   height_shift_range=0.2,\n",
    "                                   horizontal_flip=True)\n",
    "valid_data_gen = ImageDataGenerator()\n",
    "datagen.fit(train_x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/100\n",
      "  1/184 [..............................] - ETA: 0s - loss: 1.7919 - acc: 0.0938WARNING:tensorflow:Callbacks method `on_train_batch_end` is slow compared to the batch time (batch time: 0.0079s vs `on_train_batch_end` time: 0.0150s). Check your callbacks.\n",
      "183/184 [============================>.] - ETA: 0s - loss: 1.3562 - acc: 0.5799\n",
      "Epoch 00001: val_acc improved from -inf to 0.59340, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.01-0.59.h5\n",
      "184/184 [==============================] - 7s 35ms/step - loss: 1.3568 - acc: 0.5794 - val_loss: 1.3003 - val_acc: 0.5934\n",
      "Epoch 2/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 1.2854 - acc: 0.5813\n",
      "Epoch 00002: val_acc did not improve from 0.59340\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 1.2845 - acc: 0.5813 - val_loss: 1.1811 - val_acc: 0.5934\n",
      "Epoch 3/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 1.1259 - acc: 0.6196\n",
      "Epoch 00003: val_acc improved from 0.59340 to 0.60127, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.03-0.60.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 1.1254 - acc: 0.6196 - val_loss: 1.1199 - val_acc: 0.6013\n",
      "Epoch 4/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.9975 - acc: 0.6529\n",
      "Epoch 00004: val_acc improved from 0.60127 to 0.69975, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.04-0.70.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.9975 - acc: 0.6529 - val_loss: 0.8673 - val_acc: 0.6997\n",
      "Epoch 5/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.8311 - acc: 0.7055\n",
      "Epoch 00005: val_acc improved from 0.69975 to 0.75102, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.05-0.75.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.8311 - acc: 0.7055 - val_loss: 0.7009 - val_acc: 0.7510\n",
      "Epoch 6/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.7007 - acc: 0.7504\n",
      "Epoch 00006: val_acc improved from 0.75102 to 0.77970, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.06-0.78.h5\n",
      "184/184 [==============================] - 6s 35ms/step - loss: 0.7007 - acc: 0.7504 - val_loss: 0.6436 - val_acc: 0.7797\n",
      "Epoch 7/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.6029 - acc: 0.7804\n",
      "Epoch 00007: val_acc improved from 0.77970 to 0.80152, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.07-0.80.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.6029 - acc: 0.7804 - val_loss: 0.5886 - val_acc: 0.8015\n",
      "Epoch 8/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.5385 - acc: 0.8108\n",
      "Epoch 00008: val_acc did not improve from 0.80152\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.5385 - acc: 0.8108 - val_loss: 0.5642 - val_acc: 0.8015\n",
      "Epoch 9/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.4736 - acc: 0.8309\n",
      "Epoch 00009: val_acc improved from 0.80152 to 0.81675, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.09-0.82.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.4736 - acc: 0.8309 - val_loss: 0.5207 - val_acc: 0.8168\n",
      "Epoch 10/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.4228 - acc: 0.8482\n",
      "Epoch 00010: val_acc improved from 0.81675 to 0.83249, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.10-0.83.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.4228 - acc: 0.8482 - val_loss: 0.4682 - val_acc: 0.8325\n",
      "Epoch 11/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.3803 - acc: 0.8668\n",
      "Epoch 00011: val_acc did not improve from 0.83249\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.3803 - acc: 0.8668 - val_loss: 0.5127 - val_acc: 0.8226\n",
      "Epoch 12/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.3229 - acc: 0.8876\n",
      "Epoch 00012: val_acc did not improve from 0.83249\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.3228 - acc: 0.8877 - val_loss: 0.5760 - val_acc: 0.8058\n",
      "Epoch 13/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.2863 - acc: 0.9016\n",
      "Epoch 00013: val_acc did not improve from 0.83249\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.2858 - acc: 0.9018 - val_loss: 0.5669 - val_acc: 0.8061\n",
      "Epoch 14/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.2570 - acc: 0.9098\n",
      "Epoch 00014: val_acc improved from 0.83249 to 0.84264, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.14-0.84.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.2570 - acc: 0.9098 - val_loss: 0.5318 - val_acc: 0.8426\n",
      "Epoch 15/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.2132 - acc: 0.9228\n",
      "Epoch 00015: val_acc improved from 0.84264 to 0.85787, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.15-0.86.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.2132 - acc: 0.9228 - val_loss: 0.5065 - val_acc: 0.8579\n",
      "Epoch 16/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.1999 - acc: 0.9311\n",
      "Epoch 00016: val_acc did not improve from 0.85787\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.1999 - acc: 0.9311 - val_loss: 0.5961 - val_acc: 0.8500\n",
      "Epoch 17/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.1748 - acc: 0.9405\n",
      "Epoch 00017: val_acc improved from 0.85787 to 0.85812, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.17-0.86.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.1748 - acc: 0.9405 - val_loss: 0.5575 - val_acc: 0.8581\n",
      "Epoch 18/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.1538 - acc: 0.9477\n",
      "Epoch 00018: val_acc improved from 0.85812 to 0.86066, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.18-0.86.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.1532 - acc: 0.9479 - val_loss: 0.4701 - val_acc: 0.8607\n",
      "Epoch 19/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 0.1427 - acc: 0.9503\n",
      "Epoch 00019: val_acc did not improve from 0.86066\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.1425 - acc: 0.9507 - val_loss: 0.5464 - val_acc: 0.8272\n",
      "Epoch 20/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 0.1242 - acc: 0.9565\n",
      "Epoch 00020: val_acc did not improve from 0.86066\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.1256 - acc: 0.9559 - val_loss: 0.5746 - val_acc: 0.8548\n",
      "Epoch 21/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 0.1244 - acc: 0.9573\n",
      "Epoch 00021: val_acc improved from 0.86066 to 0.86269, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.21-0.86.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.1244 - acc: 0.9573 - val_loss: 0.5689 - val_acc: 0.8627\n",
      "Epoch 22/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 0.1018 - acc: 0.9647\n",
      "Epoch 00022: val_acc did not improve from 0.86269\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.1037 - acc: 0.9643 - val_loss: 0.6073 - val_acc: 0.8487\n",
      "Epoch 23/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0952 - acc: 0.9644\n",
      "Epoch 00023: val_acc did not improve from 0.86269\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0952 - acc: 0.9644 - val_loss: 0.6478 - val_acc: 0.8345\n",
      "Epoch 24/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0871 - acc: 0.9726\n",
      "Epoch 00024: val_acc improved from 0.86269 to 0.86574, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.24-0.87.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.0871 - acc: 0.9726 - val_loss: 0.5934 - val_acc: 0.8657\n",
      "Epoch 25/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0745 - acc: 0.9743\n",
      "Epoch 00025: val_acc did not improve from 0.86574\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0745 - acc: 0.9743 - val_loss: 0.6778 - val_acc: 0.8520\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 26/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 0.0870 - acc: 0.9730- ETA: 0s - loss: 0.0885 - acc: 0.\n",
      "Epoch 00026: val_acc did not improve from 0.86574\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0881 - acc: 0.9729 - val_loss: 0.6883 - val_acc: 0.8556\n",
      "Epoch 27/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0641 - acc: 0.9774\n",
      "Epoch 00027: val_acc improved from 0.86574 to 0.86701, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.27-0.87.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.0651 - acc: 0.9770 - val_loss: 0.7251 - val_acc: 0.8670\n",
      "Epoch 28/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0602 - acc: 0.9823\n",
      "Epoch 00028: val_acc improved from 0.86701 to 0.87589, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.28-0.88.h5\n",
      "184/184 [==============================] - 6s 33ms/step - loss: 0.0602 - acc: 0.9823 - val_loss: 0.5819 - val_acc: 0.8759\n",
      "Epoch 29/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0429 - acc: 0.9877- ETA: 1s - \n",
      "Epoch 00029: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0438 - acc: 0.9874 - val_loss: 0.5840 - val_acc: 0.8614\n",
      "Epoch 30/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0542 - acc: 0.9819\n",
      "Epoch 00030: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.0544 - acc: 0.9818 - val_loss: 0.6124 - val_acc: 0.8673\n",
      "Epoch 31/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0532 - acc: 0.9814\n",
      "Epoch 00031: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.0530 - acc: 0.9815 - val_loss: 0.6624 - val_acc: 0.8673\n",
      "Epoch 32/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0471 - acc: 0.9849\n",
      "Epoch 00032: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0471 - acc: 0.9849 - val_loss: 0.7132 - val_acc: 0.8726\n",
      "Epoch 33/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0267 - acc: 0.9927\n",
      "Epoch 00033: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0267 - acc: 0.9927 - val_loss: 0.7054 - val_acc: 0.8675\n",
      "Epoch 34/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0145 - acc: 0.9964\n",
      "Epoch 00034: val_acc did not improve from 0.87589\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0145 - acc: 0.9964 - val_loss: 0.8304 - val_acc: 0.8665\n",
      "Epoch 35/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0442 - acc: 0.9879\n",
      "Epoch 00035: val_acc improved from 0.87589 to 0.87665, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.35-0.88.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.0442 - acc: 0.9879 - val_loss: 0.6507 - val_acc: 0.8766\n",
      "Epoch 36/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0362 - acc: 0.9900\n",
      "Epoch 00036: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0362 - acc: 0.9900 - val_loss: 0.7197 - val_acc: 0.8673\n",
      "Epoch 37/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0327 - acc: 0.9896\n",
      "Epoch 00037: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0327 - acc: 0.9896 - val_loss: 0.7136 - val_acc: 0.8596\n",
      "Epoch 38/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0295 - acc: 0.9910\n",
      "Epoch 00038: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0295 - acc: 0.9910 - val_loss: 0.6943 - val_acc: 0.8744\n",
      "Epoch 39/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0228 - acc: 0.9930\n",
      "Epoch 00039: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0228 - acc: 0.9930 - val_loss: 0.6957 - val_acc: 0.8675\n",
      "Epoch 40/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0220 - acc: 0.9932\n",
      "Epoch 00040: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0220 - acc: 0.9932 - val_loss: 0.7768 - val_acc: 0.8662\n",
      "Epoch 41/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0208 - acc: 0.9942\n",
      "Epoch 00041: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0208 - acc: 0.9942 - val_loss: 0.7571 - val_acc: 0.8718\n",
      "Epoch 42/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0316 - acc: 0.9903- ETA: 1s - loss: 0.\n",
      "Epoch 00042: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0316 - acc: 0.9903 - val_loss: 0.7248 - val_acc: 0.8746\n",
      "Epoch 43/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0131 - acc: 0.9968\n",
      "Epoch 00043: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0131 - acc: 0.9968 - val_loss: 0.8532 - val_acc: 0.8632\n",
      "Epoch 44/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0271 - acc: 0.9925\n",
      "Epoch 00044: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0271 - acc: 0.9925 - val_loss: 0.7922 - val_acc: 0.8728\n",
      "Epoch 45/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0163 - acc: 0.9949\n",
      "Epoch 00045: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.0163 - acc: 0.9949 - val_loss: 0.8547 - val_acc: 0.8759\n",
      "Epoch 46/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0209 - acc: 0.9928\n",
      "Epoch 00046: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0208 - acc: 0.9929 - val_loss: 0.9718 - val_acc: 0.8439\n",
      "Epoch 47/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0429 - acc: 0.9883- ETA: 1s - loss: 0\n",
      "Epoch 00047: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0429 - acc: 0.9883 - val_loss: 0.6286 - val_acc: 0.8716\n",
      "Epoch 48/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0072 - acc: 0.9976\n",
      "Epoch 00048: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0072 - acc: 0.9976 - val_loss: 0.7970 - val_acc: 0.8731\n",
      "Epoch 49/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0060 - acc: 0.9985- ETA: 1s - loss: 0.00\n",
      "Epoch 00049: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0060 - acc: 0.9985 - val_loss: 0.8904 - val_acc: 0.8739\n",
      "Epoch 50/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 0.0173 - acc: 0.9940\n",
      "Epoch 00050: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 0.0173 - acc: 0.9940 - val_loss: 0.6522 - val_acc: 0.8734\n",
      "Epoch 51/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0088 - acc: 0.9978\n",
      "Epoch 00051: val_acc did not improve from 0.87665\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 0.0088 - acc: 0.9978 - val_loss: 0.7562 - val_acc: 0.8766\n",
      "Epoch 52/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 0.0017 - acc: 0.9993\n",
      "Epoch 00052: val_acc improved from 0.87665 to 0.87792, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.52-0.88.h5\n",
      "184/184 [==============================] - 6s 32ms/step - loss: 0.0017 - acc: 0.9993 - val_loss: 0.8585 - val_acc: 0.8779\n",
      "Epoch 53/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 6.5715e-04 - acc: 0.9995\n",
      "Epoch 00053: val_acc improved from 0.87792 to 0.88198, saving model to D:\\Projects\\PycharmProjects\\Grad\\BITVehicle\\data/trained_model\\vgg19_model.53-0.88.h5\n",
      "184/184 [==============================] - 6s 34ms/step - loss: 6.5715e-04 - acc: 0.9995 - val_loss: 0.8742 - val_acc: 0.8820\n",
      "Epoch 54/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 4.2960e-04 - acc: 0.9998\n",
      "Epoch 00054: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.2960e-04 - acc: 0.9998 - val_loss: 0.8960 - val_acc: 0.8817\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 55/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.2229e-04 - acc: 0.9998\n",
      "Epoch 00055: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 3.2229e-04 - acc: 0.9998 - val_loss: 0.9025 - val_acc: 0.8807\n",
      "Epoch 56/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 1.0566e-04 - acc: 1.0000\n",
      "Epoch 00056: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 28ms/step - loss: 1.0512e-04 - acc: 1.0000 - val_loss: 0.9227 - val_acc: 0.8805\n",
      "Epoch 57/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 4.3181e-04 - acc: 0.9997\n",
      "Epoch 00057: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.2966e-04 - acc: 0.9997 - val_loss: 0.9367 - val_acc: 0.8807\n",
      "Epoch 58/100\n",
      "183/184 [============================>.] - ETA: 0s - loss: 2.9978e-04 - acc: 0.9998- ETA: \n",
      "Epoch 00058: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 2.9868e-04 - acc: 0.9998 - val_loss: 0.9515 - val_acc: 0.8807\n",
      "Epoch 59/100\n",
      "182/184 [============================>.] - ETA: 0s - loss: 4.5107e-04 - acc: 0.9997- ETA: 0s - loss: 4.6516e-04 - acc: 0.99\n",
      "Epoch 00059: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.4641e-04 - acc: 0.9997 - val_loss: 0.9475 - val_acc: 0.8810\n",
      "Epoch 60/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 4.2800e-04 - acc: 0.9997- ETA: 2s - \n",
      "Epoch 00060: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.2800e-04 - acc: 0.9997 - val_loss: 0.9509 - val_acc: 0.8807\n",
      "Epoch 61/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 4.2235e-04 - acc: 0.9998\n",
      "Epoch 00061: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.2235e-04 - acc: 0.9998 - val_loss: 0.9586 - val_acc: 0.8810\n",
      "Epoch 62/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.5179e-04 - acc: 0.9997- ETA: 0s - loss: 3.6258e-04 - acc: 0.99\n",
      "Epoch 00062: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.5179e-04 - acc: 0.9997 - val_loss: 0.9684 - val_acc: 0.8812\n",
      "Epoch 63/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 2.9150e-04 - acc: 0.9998\n",
      "Epoch 00063: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 2.9150e-04 - acc: 0.9998 - val_loss: 0.9825 - val_acc: 0.8812\n",
      "Epoch 64/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.4918e-04 - acc: 0.9997\n",
      "Epoch 00064: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.4918e-04 - acc: 0.9997 - val_loss: 0.9863 - val_acc: 0.8815\n",
      "Epoch 65/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 2.9764e-04 - acc: 0.9998- ETA: 0s - loss: 3.4627e-04 - ac\n",
      "Epoch 00065: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 2.9764e-04 - acc: 0.9998 - val_loss: 0.9928 - val_acc: 0.8812\n",
      "Epoch 66/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.0938e-04 - acc: 0.9998\n",
      "Epoch 00066: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.0938e-04 - acc: 0.9998 - val_loss: 0.9997 - val_acc: 0.8810\n",
      "Epoch 67/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 2.5412e-04 - acc: 0.9998\n",
      "Epoch 00067: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 2.5412e-04 - acc: 0.9998 - val_loss: 1.0101 - val_acc: 0.8807\n",
      "Epoch 68/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 1.8264e-04 - acc: 1.0000\n",
      "Epoch 00068: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 1.8264e-04 - acc: 1.0000 - val_loss: 1.0253 - val_acc: 0.8805\n",
      "Epoch 69/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.6140e-04 - acc: 0.9997\n",
      "Epoch 00069: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.6140e-04 - acc: 0.9997 - val_loss: 1.0211 - val_acc: 0.8812\n",
      "Epoch 70/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.5300e-04 - acc: 0.9997\n",
      "Epoch 00070: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.5300e-04 - acc: 0.9997 - val_loss: 1.0202 - val_acc: 0.8807\n",
      "Epoch 71/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 4.0123e-04 - acc: 0.9997\n",
      "Epoch 00071: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 4.0123e-04 - acc: 0.9997 - val_loss: 1.0139 - val_acc: 0.8802\n",
      "Epoch 72/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 3.3698e-04 - acc: 0.9997\n",
      "Epoch 00072: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 3.3698e-04 - acc: 0.9997 - val_loss: 1.0218 - val_acc: 0.8805\n",
      "Epoch 73/100\n",
      "184/184 [==============================] - ETA: 0s - loss: 2.6646e-04 - acc: 0.9997Restoring model weights from the end of the best epoch.\n",
      "\n",
      "Epoch 00073: val_acc did not improve from 0.88198\n",
      "184/184 [==============================] - 5s 27ms/step - loss: 2.6646e-04 - acc: 0.9997 - val_loss: 1.0305 - val_acc: 0.8807\n",
      "Epoch 00073: early stopping\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x267bd249d30>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "batch_size = 32\n",
    "epochs = 100\n",
    "iterations = 184\n",
    "model.fit_generator(datagen.flow(train_x, train_y, batch_size=batch_size),\n",
    "                    steps_per_epoch=iterations,\n",
    "                    epochs=epochs,\n",
    "                    callbacks=cbks,\n",
    "                    validation_data=valid_data_gen.flow(test_x, test_y, batch_size=batch_size))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def build_model_with_resnet50(freeze_wights=False):\n",
    "\n",
    "    Backbone = ResNet50(\n",
    "    include_top=False, weights='imagenet', pooling='avg')\n",
    "\n",
    "    if freeze_wights:\n",
    "        Backbone.trainable = False\n",
    "        for layer in Backbone.layers:\n",
    "            if \"BatchNormalization\" in layer.__class__.__name__:\n",
    "                layer.trainable = True\n",
    "            else:\n",
    "                layer.trainable = False\n",
    "    else:\n",
    "        Backbone.trainable = True\n",
    "\n",
    "    X = BatchNormalization()(Backbone.output)\n",
    "\n",
    "    X = Flatten(name=\"flatten\")(X)\n",
    "    \n",
    "    X = Dense(1024)(X)\n",
    "    X = Activation('relu')(X) \n",
    "\n",
    "    X = BatchNormalization()(X)\n",
    "\n",
    "    X = Dense(num_class)(X)\n",
    "    X = Activation('softmax')(X)\n",
    "\n",
    "    model = Model(Backbone.input, X)\n",
    "\n",
    "    return model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "def build_model_with_denseNet121(freeze_wights=False):\n",
    "\n",
    "    Backbone = densenet.DenseNet121(\n",
    "    include_top=False, weights='imagenet', pooling='avg')\n",
    "\n",
    "    if freeze_wights:\n",
    "        Backbone.trainable = False\n",
    "        for layer in Backbone.layers:\n",
    "            if \"BatchNormalization\" in layer.__class__.__name__:\n",
    "                layer.trainable = True\n",
    "            else:\n",
    "                layer.trainable = False\n",
    "    else:\n",
    "        Backbone.trainable = True\n",
    "\n",
    "    X = BatchNormalization()(Backbone.output)\n",
    "\n",
    "    X = Flatten(name=\"flatten\")(X)\n",
    "    \n",
    "    X = Dense(1024)(X)\n",
    "    X = Activation('relu')(X) \n",
    "\n",
    "    X = BatchNormalization()(X)\n",
    "\n",
    "    X = Dense(num_class)(X)\n",
    "    X = Activation('softmax')(X)\n",
    "\n",
    "    model = Model(Backbone.input, X)\n",
    "\n",
    "    return model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "ResNet_model = build_model_with_denseNet121()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "loss = 'categorical_crossentropy'\n",
    "optimizer = optimizers.Adam(lr=1e-4)\n",
    "ResNet_model.compile(loss=loss , optimizer= optimizer, metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "# sgd = optimizers.SGD(lr=0.01, decay=1e-4, momentum=0.9, nesterov=True)\n",
    "optimizer = optimizers.Adam(lr=1e-4)\n",
    "ResNet_model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['acc'])\n",
    "\n",
    "# change_lr = LearningRateScheduler(scheduler)\n",
    "reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=3, verbose=1, min_delta=1e-6)\n",
    "\n",
    "save_dir = os.path.join(os.getcwd(), '../../data/trained_model')\n",
    "model_name = 'densenet121_model.{epoch:02d}-{val_acc:.2f}.h5'\n",
    "if not os.path.isdir(save_dir):\n",
    "    os.makedirs(save_dir)\n",
    "filepath = os.path.join(save_dir, model_name)\n",
    "\n",
    "checkpoint = ModelCheckpoint(filepath=filepath,\n",
    "                             monitor='val_acc',\n",
    "                             verbose=1,\n",
    "                             save_best_only=True)\n",
    "\n",
    "#creating early stopping to prevent model from overfitting \n",
    "early_stopping = EarlyStopping(monitor=\"val_acc\", min_delta=0,\n",
    "                                                  patience=8, verbose=1, \n",
    "                                                  mode=\"auto\", baseline=None, \n",
    "                                                  restore_best_weights=True)\n",
    "\n",
    "cbks = [early_stopping, checkpoint, reduce_lr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_data_gen = ImageDataGenerator(rotation_range=40,\n",
    "    zoom_range=0.2,\n",
    "    width_shift_range=0.2,\n",
    "    height_shift_range=0.2,\n",
    "    shear_range=0.2,\n",
    "    horizontal_flip=True,\n",
    "    fill_mode=\"nearest\")\n",
    "valid_data_gen = ImageDataGenerator()\n",
    "train_data_gen.fit(train_x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 1.1510 - acc: 0.6330- ETA: 0s - loss: 1.1644 - ac - ETA: 0s - loss: 1.1589 - acc: \n",
      "Epoch 00001: val_acc improved from 0.60787 to 0.64162, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.01-0.64.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 1.1510 - acc: 0.6330 - val_loss: 1.0743 - val_acc: 0.6416\n",
      "Epoch 2/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.9952 - acc: 0.6716\n",
      "Epoch 00002: val_acc improved from 0.64162 to 0.68528, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.02-0.69.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.9952 - acc: 0.6716 - val_loss: 0.9653 - val_acc: 0.6853\n",
      "Epoch 3/200\n",
      "184/185 [============================>.] - ETA: 0s - loss: 0.9540 - acc: 0.6825- ETA: 3s - loss: 0.944 -\n",
      "Epoch 00003: val_acc improved from 0.68528 to 0.71523, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.03-0.72.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.9523 - acc: 0.6829 - val_loss: 0.8728 - val_acc: 0.7152\n",
      "Epoch 4/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.8886 - acc: 0.6981- ETA: 1s - loss: 0\n",
      "Epoch 00004: val_acc did not improve from 0.71523\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.8886 - acc: 0.6981 - val_loss: 0.9422 - val_acc: 0.7043\n",
      "Epoch 5/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.8260 - acc: 0.7176- \n",
      "Epoch 00005: val_acc improved from 0.71523 to 0.72690, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.05-0.73.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.8260 - acc: 0.7176 - val_loss: 0.8580 - val_acc: 0.7269\n",
      "Epoch 6/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.7869 - acc: 0.7271- ETA\n",
      "Epoch 00006: val_acc improved from 0.72690 to 0.73071, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.06-0.73.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.7869 - acc: 0.7271 - val_loss: 0.8727 - val_acc: 0.7307\n",
      "Epoch 7/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.7477 - acc: 0.7347- ETA: - ETA: 1s - loss: 0.7541  - ETA: 0s - loss: 0.749\n",
      "Epoch 00007: val_acc improved from 0.73071 to 0.73909, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.07-0.74.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.7477 - acc: 0.7347 - val_loss: 0.7743 - val_acc: 0.7391\n",
      "Epoch 8/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.7023 - acc: 0.7497\n",
      "Epoch 00008: val_acc improved from 0.73909 to 0.76726, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.08-0.77.h5\n",
      "185/185 [==============================] - 8s 44ms/step - loss: 0.7023 - acc: 0.7497 - val_loss: 0.6667 - val_acc: 0.7673\n",
      "Epoch 9/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6945 - acc: 0.753 - ETA: 0s - loss: 0.6937 - acc: 0.7535\n",
      "Epoch 00009: val_acc did not improve from 0.76726\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.6937 - acc: 0.7535 - val_loss: 0.7954 - val_acc: 0.7442\n",
      "Epoch 10/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6687 - acc: 0.7692\n",
      "Epoch 00010: val_acc did not improve from 0.76726\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.6687 - acc: 0.7692 - val_loss: 0.7130 - val_acc: 0.7510\n",
      "Epoch 11/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6498 - acc: 0.7709- ETA\n",
      "Epoch 00011: val_acc improved from 0.76726 to 0.77056, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.11-0.77.h5\n",
      "185/185 [==============================] - 8s 44ms/step - loss: 0.6498 - acc: 0.7709 - val_loss: 0.6367 - val_acc: 0.7706\n",
      "Epoch 12/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6260 - acc: 0.7819- ETA: 1s - loss\n",
      "Epoch 00012: val_acc improved from 0.77056 to 0.77716, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.12-0.78.h5\n",
      "185/185 [==============================] - 8s 44ms/step - loss: 0.6260 - acc: 0.7819 - val_loss: 0.6243 - val_acc: 0.7772\n",
      "Epoch 13/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5970 - acc: 0.7861\n",
      "Epoch 00013: val_acc did not improve from 0.77716\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.5970 - acc: 0.7861 - val_loss: 0.6503 - val_acc: 0.7655\n",
      "Epoch 14/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5646 - acc: 0.8019\n",
      "Epoch 00014: val_acc improved from 0.77716 to 0.79162, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.14-0.79.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.5646 - acc: 0.8019 - val_loss: 0.6278 - val_acc: 0.7916\n",
      "Epoch 15/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5830 - acc: 0.7898\n",
      "Epoch 00015: val_acc improved from 0.79162 to 0.81802, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\densenet121_model.15-0.82.h5\n",
      "185/185 [==============================] - 8s 43ms/step - loss: 0.5830 - acc: 0.7898 - val_loss: 0.5143 - val_acc: 0.8180\n",
      "Epoch 16/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5668 - acc: 0.8019\n",
      "Epoch 00016: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.5668 - acc: 0.8019 - val_loss: 0.5627 - val_acc: 0.7962\n",
      "Epoch 17/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5498 - acc: 0.8032- ETA: 2s - loss: 0. - ETA: 1s - loss: 0.\n",
      "Epoch 00017: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.5498 - acc: 0.8032 - val_loss: 0.5939 - val_acc: 0.7754\n",
      "Epoch 18/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5113 - acc: 0.8132- ETA: 3s - loss: 0.5 - ETA: 2s - l - ETA: 1s - loss: 0.5010 - acc: 0.816 - ETA: 0s - loss: 0.500\n",
      "Epoch 00018: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.5113 - acc: 0.8132 - val_loss: 0.5117 - val_acc: 0.8117\n",
      "Epoch 19/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4980 - acc: 0.8237- ETA: 4s - loss: 0.4537 - acc: 0. - ETA: 4s - loss: 0.4620 - acc: 0. - ETA: 4s -  - ETA: 2s - loss: 0.4982 - acc: 0.822 -\n",
      "Epoch 00019: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 0.4980 - acc: 0.8237 - val_loss: 0.6925 - val_acc: 0.7419\n",
      "Epoch 20/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4879 - acc: 0.8276\n",
      "Epoch 00020: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.4879 - acc: 0.8276 - val_loss: 0.8357 - val_acc: 0.7000\n",
      "Epoch 21/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4892 - acc: 0.8252- ETA: \n",
      "Epoch 00021: val_acc did not improve from 0.81802\n",
      "\n",
      "Epoch 00021: ReduceLROnPlateau reducing learning rate to 9.999999747378752e-06.\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.4892 - acc: 0.8252 - val_loss: 0.5290 - val_acc: 0.8162\n",
      "Epoch 22/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4433 - acc: 0.8350\n",
      "Epoch 00022: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.4433 - acc: 0.8350 - val_loss: 0.5458 - val_acc: 0.7995\n",
      "Epoch 23/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4320 - acc: 0.8467Restoring model weights from the end of the best epoch.\n",
      "\n",
      "Epoch 00023: val_acc did not improve from 0.81802\n",
      "185/185 [==============================] - 7s 40ms/step - loss: 0.4320 - acc: 0.8467 - val_loss: 0.5835 - val_acc: 0.7843\n",
      "Epoch 00023: early stopping\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x1f39c33dd30>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "batch_size = 32\n",
    "epochs = 200\n",
    "iterations = 185\n",
    "ResNet_model.fit(train_data_gen.flow(train_x, train_y, batch_size=batch_size),\n",
    "                    steps_per_epoch=iterations,\n",
    "                    epochs=epochs,\n",
    "                    callbacks=cbks,\n",
    "                    validation_data=valid_data_gen.flow(test_x, test_y, batch_size=batch_size))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def build_model_with_vgg16(freeze_wights=False):\n",
    "\n",
    "    Backbone = VGG16(\n",
    "    include_top=False, weights='imagenet', pooling='avg')\n",
    "\n",
    "    if freeze_wights:\n",
    "        Backbone.trainable = False\n",
    "        for layer in Backbone.layers:\n",
    "            if \"BatchNormalization\" in layer.__class__.__name__:\n",
    "                layer.trainable = True\n",
    "            else:\n",
    "                layer.trainable = False\n",
    "    else:\n",
    "        Backbone.trainable = True\n",
    "\n",
    "    X = BatchNormalization()(Backbone.output)\n",
    "\n",
    "    X = Flatten(name=\"flatten\")(X)\n",
    "    \n",
    "    X = Dense(1024)(X)\n",
    "    X = Activation('relu')(X) \n",
    "\n",
    "    X = BatchNormalization()(X)\n",
    "\n",
    "    X = Dense(num_class)(X)\n",
    "    X = Activation('softmax')(X)\n",
    "\n",
    "    model = Model(Backbone.input, X)\n",
    "\n",
    "    return model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"functional_1\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "input_1 (InputLayer)         [(None, None, None, 3)]   0         \n",
      "_________________________________________________________________\n",
      "block1_conv1 (Conv2D)        (None, None, None, 64)    1792      \n",
      "_________________________________________________________________\n",
      "block1_conv2 (Conv2D)        (None, None, None, 64)    36928     \n",
      "_________________________________________________________________\n",
      "block1_pool (MaxPooling2D)   (None, None, None, 64)    0         \n",
      "_________________________________________________________________\n",
      "block2_conv1 (Conv2D)        (None, None, None, 128)   73856     \n",
      "_________________________________________________________________\n",
      "block2_conv2 (Conv2D)        (None, None, None, 128)   147584    \n",
      "_________________________________________________________________\n",
      "block2_pool (MaxPooling2D)   (None, None, None, 128)   0         \n",
      "_________________________________________________________________\n",
      "block3_conv1 (Conv2D)        (None, None, None, 256)   295168    \n",
      "_________________________________________________________________\n",
      "block3_conv2 (Conv2D)        (None, None, None, 256)   590080    \n",
      "_________________________________________________________________\n",
      "block3_conv3 (Conv2D)        (None, None, None, 256)   590080    \n",
      "_________________________________________________________________\n",
      "block3_pool (MaxPooling2D)   (None, None, None, 256)   0         \n",
      "_________________________________________________________________\n",
      "block4_conv1 (Conv2D)        (None, None, None, 512)   1180160   \n",
      "_________________________________________________________________\n",
      "block4_conv2 (Conv2D)        (None, None, None, 512)   2359808   \n",
      "_________________________________________________________________\n",
      "block4_conv3 (Conv2D)        (None, None, None, 512)   2359808   \n",
      "_________________________________________________________________\n",
      "block4_pool (MaxPooling2D)   (None, None, None, 512)   0         \n",
      "_________________________________________________________________\n",
      "block5_conv1 (Conv2D)        (None, None, None, 512)   2359808   \n",
      "_________________________________________________________________\n",
      "block5_conv2 (Conv2D)        (None, None, None, 512)   2359808   \n",
      "_________________________________________________________________\n",
      "block5_conv3 (Conv2D)        (None, None, None, 512)   2359808   \n",
      "_________________________________________________________________\n",
      "block5_pool (MaxPooling2D)   (None, None, None, 512)   0         \n",
      "_________________________________________________________________\n",
      "global_average_pooling2d (Gl (None, 512)               0         \n",
      "_________________________________________________________________\n",
      "batch_normalization (BatchNo (None, 512)               2048      \n",
      "_________________________________________________________________\n",
      "flatten (Flatten)            (None, 512)               0         \n",
      "_________________________________________________________________\n",
      "dense (Dense)                (None, 1024)              525312    \n",
      "_________________________________________________________________\n",
      "activation (Activation)      (None, 1024)              0         \n",
      "_________________________________________________________________\n",
      "batch_normalization_1 (Batch (None, 1024)              4096      \n",
      "_________________________________________________________________\n",
      "dense_1 (Dense)              (None, 6)                 6150      \n",
      "_________________________________________________________________\n",
      "activation_1 (Activation)    (None, 6)                 0         \n",
      "=================================================================\n",
      "Total params: 15,252,294\n",
      "Trainable params: 15,249,222\n",
      "Non-trainable params: 3,072\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model = build_model_with_vgg16()\n",
    "model.summary()#显示模型结构"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "loss = 'categorical_crossentropy'\n",
    "optimizer = optimizers.Adam(lr=1e-4)\n",
    "model.compile(loss=loss , optimizer= optimizer, metrics=['accuracy'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "# sgd = optimizers.SGD(lr=0.01, decay=1e-4, momentum=0.9, nesterov=True)\n",
    "optimizer = optimizers.Adam(lr=1e-4)\n",
    "model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['acc'])\n",
    "\n",
    "# change_lr = LearningRateScheduler(scheduler)\n",
    "reduce_lr = ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=3, verbose=1, min_delta=1e-6)\n",
    "\n",
    "save_dir = os.path.join(os.getcwd(), '../../data/trained_model')\n",
    "model_name = 'vgg16_model.{epoch:02d}-{val_acc:.2f}.h5'\n",
    "if not os.path.isdir(save_dir):\n",
    "    os.makedirs(save_dir)\n",
    "filepath = os.path.join(save_dir, model_name)\n",
    "\n",
    "checkpoint = ModelCheckpoint(filepath=filepath,\n",
    "                             monitor='val_acc',\n",
    "                             verbose=1,\n",
    "                             save_best_only=True)\n",
    "\n",
    "#creating early stopping to prevent model from overfitting \n",
    "early_stopping = EarlyStopping(monitor=\"val_acc\", min_delta=0,\n",
    "                                                  patience=8, verbose=1, \n",
    "                                                  mode=\"auto\", baseline=None, \n",
    "                                                  restore_best_weights=True)\n",
    "\n",
    "cbks = [early_stopping, checkpoint, reduce_lr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_data_gen = ImageDataGenerator(rotation_range=40,\n",
    "    zoom_range=0.2,\n",
    "    width_shift_range=0.2,\n",
    "    height_shift_range=0.2,\n",
    "    shear_range=0.2,\n",
    "    horizontal_flip=True,\n",
    "    fill_mode=\"nearest\")\n",
    "valid_data_gen = ImageDataGenerator()\n",
    "train_data_gen.fit(train_x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/200\n",
      "  1/185 [..............................] - ETA: 0s - loss: 2.6300 - acc: 0.0938WARNING:tensorflow:Callbacks method `on_train_batch_end` is slow compared to the batch time (batch time: 0.0100s vs `on_train_batch_end` time: 0.0179s). Check your callbacks.\n",
      "185/185 [==============================] - ETA: 0s - loss: 1.3673 - acc: 0.5557\n",
      "Epoch 00001: val_acc improved from -inf to 0.32766, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.01-0.33.h5\n",
      "185/185 [==============================] - 7s 39ms/step - loss: 1.3673 - acc: 0.5557 - val_loss: 2.4775 - val_acc: 0.3277\n",
      "Epoch 2/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 1.0067 - acc: 0.6668\n",
      "Epoch 00002: val_acc improved from 0.32766 to 0.56802, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.02-0.57.h5\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 1.0067 - acc: 0.6668 - val_loss: 1.3219 - val_acc: 0.5680\n",
      "Epoch 3/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.8805 - acc: 0.7002\n",
      "Epoch 00003: val_acc improved from 0.56802 to 0.64112, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.03-0.64.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.8805 - acc: 0.7002 - val_loss: 1.2207 - val_acc: 0.6411\n",
      "Epoch 4/200\n",
      "184/185 [============================>.] - ETA: 0s - loss: 0.8109 - acc: 0.7178\n",
      "Epoch 00004: val_acc did not improve from 0.64112\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.8124 - acc: 0.7168 - val_loss: 0.9320 - val_acc: 0.6183\n",
      "Epoch 5/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.7465 - acc: 0.7391\n",
      "Epoch 00005: val_acc improved from 0.64112 to 0.74949, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.05-0.75.h5\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.7465 - acc: 0.7391 - val_loss: 0.6679 - val_acc: 0.7495\n",
      "Epoch 6/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.7091 - acc: 0.7491\n",
      "Epoch 00006: val_acc did not improve from 0.74949\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.7091 - acc: 0.7491 - val_loss: 0.7876 - val_acc: 0.7079\n",
      "Epoch 7/200\n",
      "184/185 [============================>.] - ETA: 0s - loss: 0.6808 - acc: 0.7608\n",
      "Epoch 00007: val_acc improved from 0.74949 to 0.79239, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.07-0.79.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.6796 - acc: 0.7614 - val_loss: 0.5879 - val_acc: 0.7924\n",
      "Epoch 8/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6852 - acc: 0.7584\n",
      "Epoch 00008: val_acc did not improve from 0.79239\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.6852 - acc: 0.7584 - val_loss: 0.6373 - val_acc: 0.7822\n",
      "Epoch 9/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6395 - acc: 0.7787\n",
      "Epoch 00009: val_acc improved from 0.79239 to 0.79848, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.09-0.80.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.6395 - acc: 0.7787 - val_loss: 0.5697 - val_acc: 0.7985\n",
      "Epoch 10/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.6116 - acc: 0.7831\n",
      "Epoch 00010: val_acc improved from 0.79848 to 0.81853, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.10-0.82.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.6116 - acc: 0.7831 - val_loss: 0.5412 - val_acc: 0.8185\n",
      "Epoch 11/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5983 - acc: 0.7888- ETA: 0s - loss: 0.5986\n",
      "Epoch 00011: val_acc did not improve from 0.81853\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.5983 - acc: 0.7888 - val_loss: 0.6627 - val_acc: 0.7876\n",
      "Epoch 12/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5615 - acc: 0.7998\n",
      "Epoch 00012: val_acc did not improve from 0.81853\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.5615 - acc: 0.7998 - val_loss: 0.6858 - val_acc: 0.7467\n",
      "Epoch 13/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5592 - acc: 0.8008\n",
      "Epoch 00013: val_acc improved from 0.81853 to 0.82107, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.13-0.82.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.5592 - acc: 0.8008 - val_loss: 0.5355 - val_acc: 0.8211\n",
      "Epoch 14/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5471 - acc: 0.8020\n",
      "Epoch 00014: val_acc did not improve from 0.82107\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.5471 - acc: 0.8020 - val_loss: 0.9552 - val_acc: 0.6292\n",
      "Epoch 15/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5346 - acc: 0.8066- ETA: 3s -  - ETA: 1s\n",
      "Epoch 00015: val_acc improved from 0.82107 to 0.82259, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.15-0.82.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.5346 - acc: 0.8066 - val_loss: 0.5377 - val_acc: 0.8226\n",
      "Epoch 16/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.5031 - acc: 0.8210\n",
      "Epoch 00016: val_acc improved from 0.82259 to 0.84772, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.16-0.85.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.5031 - acc: 0.8210 - val_loss: 0.4501 - val_acc: 0.8477\n",
      "Epoch 17/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4976 - acc: 0.8227\n",
      "Epoch 00017: val_acc improved from 0.84772 to 0.85431, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.17-0.85.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.4976 - acc: 0.8227 - val_loss: 0.4346 - val_acc: 0.8543\n",
      "Epoch 18/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4997 - acc: 0.8242\n",
      "Epoch 00018: val_acc did not improve from 0.85431\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.4997 - acc: 0.8242 - val_loss: 0.6020 - val_acc: 0.7853\n",
      "Epoch 19/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4867 - acc: 0.8262\n",
      "Epoch 00019: val_acc improved from 0.85431 to 0.85533, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.19-0.86.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.4867 - acc: 0.8262 - val_loss: 0.4196 - val_acc: 0.8553\n",
      "Epoch 20/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4673 - acc: 0.8335\n",
      "Epoch 00020: val_acc did not improve from 0.85533\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.4673 - acc: 0.8335 - val_loss: 0.4325 - val_acc: 0.8551\n",
      "Epoch 21/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4521 - acc: 0.8428\n",
      "Epoch 00021: val_acc did not improve from 0.85533\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.4521 - acc: 0.8428 - val_loss: 0.4658 - val_acc: 0.8312\n",
      "Epoch 22/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.4440 - acc: 0.8403\n",
      "Epoch 00022: val_acc did not improve from 0.85533\n",
      "\n",
      "Epoch 00022: ReduceLROnPlateau reducing learning rate to 9.999999747378752e-06.\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.4440 - acc: 0.8403 - val_loss: 0.4873 - val_acc: 0.8228\n",
      "Epoch 23/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3659 - acc: 0.8704\n",
      "Epoch 00023: val_acc improved from 0.85533 to 0.87208, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.23-0.87.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3659 - acc: 0.8704 - val_loss: 0.3740 - val_acc: 0.8721\n",
      "Epoch 24/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3587 - acc: 0.8711\n",
      "Epoch 00024: val_acc did not improve from 0.87208\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.3587 - acc: 0.8711 - val_loss: 0.3886 - val_acc: 0.8706\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 25/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3316 - acc: 0.8804\n",
      "Epoch 00025: val_acc improved from 0.87208 to 0.87538, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.25-0.88.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3316 - acc: 0.8804 - val_loss: 0.3789 - val_acc: 0.8754\n",
      "Epoch 26/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3305 - acc: 0.8838\n",
      "Epoch 00026: val_acc improved from 0.87538 to 0.87589, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.26-0.88.h5\n",
      "\n",
      "Epoch 00026: ReduceLROnPlateau reducing learning rate to 9.999999747378752e-07.\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3305 - acc: 0.8838 - val_loss: 0.3809 - val_acc: 0.8759\n",
      "Epoch 27/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3254 - acc: 0.8807\n",
      "Epoch 00027: val_acc improved from 0.87589 to 0.87792, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.27-0.88.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3254 - acc: 0.8807 - val_loss: 0.3727 - val_acc: 0.8779\n",
      "Epoch 28/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3182 - acc: 0.8883\n",
      "Epoch 00028: val_acc improved from 0.87792 to 0.87868, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.28-0.88.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3182 - acc: 0.8883 - val_loss: 0.3717 - val_acc: 0.8787\n",
      "Epoch 29/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3193 - acc: 0.8856\n",
      "Epoch 00029: val_acc did not improve from 0.87868\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.3193 - acc: 0.8856 - val_loss: 0.3707 - val_acc: 0.8782\n",
      "Epoch 30/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3127 - acc: 0.8892\n",
      "Epoch 00030: val_acc improved from 0.87868 to 0.87893, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.30-0.88.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3127 - acc: 0.8892 - val_loss: 0.3701 - val_acc: 0.8789\n",
      "Epoch 31/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3266 - acc: 0.8885\n",
      "Epoch 00031: val_acc did not improve from 0.87893\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3266 - acc: 0.8885 - val_loss: 0.3710 - val_acc: 0.8777\n",
      "Epoch 32/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3176 - acc: 0.8876\n",
      "Epoch 00032: val_acc improved from 0.87893 to 0.88096, saving model to D:\\Projects\\PycharmProjects\\Grad_\\runners\\train\\../../data/trained_model\\vgg16_model.32-0.88.h5\n",
      "185/185 [==============================] - 6s 34ms/step - loss: 0.3176 - acc: 0.8876 - val_loss: 0.3640 - val_acc: 0.8810\n",
      "Epoch 33/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3139 - acc: 0.8870\n",
      "Epoch 00033: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3139 - acc: 0.8870 - val_loss: 0.3719 - val_acc: 0.8761\n",
      "Epoch 34/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3157 - acc: 0.8926\n",
      "Epoch 00034: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3157 - acc: 0.8926 - val_loss: 0.3737 - val_acc: 0.8741\n",
      "Epoch 35/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3159 - acc: 0.8865\n",
      "Epoch 00035: val_acc did not improve from 0.88096\n",
      "\n",
      "Epoch 00035: ReduceLROnPlateau reducing learning rate to 9.999999974752428e-08.\n",
      "185/185 [==============================] - 6s 32ms/step - loss: 0.3159 - acc: 0.8865 - val_loss: 0.3726 - val_acc: 0.8749\n",
      "Epoch 36/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3054 - acc: 0.8934\n",
      "Epoch 00036: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3054 - acc: 0.8934 - val_loss: 0.3727 - val_acc: 0.8739\n",
      "Epoch 37/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3119 - acc: 0.8892\n",
      "Epoch 00037: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3119 - acc: 0.8892 - val_loss: 0.3736 - val_acc: 0.8736\n",
      "Epoch 38/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3065 - acc: 0.8919\n",
      "Epoch 00038: val_acc did not improve from 0.88096\n",
      "\n",
      "Epoch 00038: ReduceLROnPlateau reducing learning rate to 1.0000000116860975e-08.\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3065 - acc: 0.8919 - val_loss: 0.3724 - val_acc: 0.8746\n",
      "Epoch 39/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3043 - acc: 0.8942\n",
      "Epoch 00039: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3043 - acc: 0.8942 - val_loss: 0.3711 - val_acc: 0.8759\n",
      "Epoch 40/200\n",
      "185/185 [==============================] - ETA: 0s - loss: 0.3029 - acc: 0.8878Restoring model weights from the end of the best epoch.\n",
      "\n",
      "Epoch 00040: val_acc did not improve from 0.88096\n",
      "185/185 [==============================] - 6s 33ms/step - loss: 0.3029 - acc: 0.8878 - val_loss: 0.3742 - val_acc: 0.8728\n",
      "Epoch 00040: early stopping\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x1f5fc88b470>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "batch_size = 32\n",
    "epochs = 200\n",
    "iterations = 185\n",
    "model.fit(train_data_gen.flow(train_x, train_y, batch_size=batch_size),\n",
    "                    steps_per_epoch=iterations,\n",
    "                    epochs=epochs,\n",
    "                    callbacks=cbks,\n",
    "                    validation_data=valid_data_gen.flow(test_x, test_y, batch_size=batch_size))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = load_model('../../data/neural_networks/Car_ResNet50.h5')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"class_name\": \"Functional\", \"config\": {\"name\": \"functional_1\", \"layers\": [{\"class_name\": \"InputLayer\", \"config\": {\"batch_input_shape\": [null, null, null, 3], \"dtype\": \"float32\", \"sparse\": false, \"ragged\": false, \"name\": \"input_1\"}, \"name\": \"input_1\", \"inbound_nodes\": []}, {\"class_name\": \"ZeroPadding2D\", \"config\": {\"name\": \"conv1_pad\", \"trainable\": true, \"dtype\": \"float32\", \"padding\": [[3, 3], [3, 3]], \"data_format\": \"channels_last\"}, \"name\": \"conv1_pad\", \"inbound_nodes\": [[[\"input_1\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [7, 7], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv1_conv\", \"inbound_nodes\": [[[\"conv1_pad\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv1_bn\", \"inbound_nodes\": [[[\"conv1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv1_relu\", \"inbound_nodes\": [[[\"conv1_bn\", 0, 0, {}]]]}, {\"class_name\": \"ZeroPadding2D\", \"config\": {\"name\": \"pool1_pad\", \"trainable\": true, \"dtype\": \"float32\", \"padding\": [[1, 1], [1, 1]], \"data_format\": \"channels_last\"}, \"name\": \"pool1_pad\", \"inbound_nodes\": [[[\"conv1_relu\", 0, 0, {}]]]}, {\"class_name\": \"MaxPooling2D\", \"config\": {\"name\": \"pool1_pool\", \"trainable\": true, \"dtype\": \"float32\", \"pool_size\": [3, 3], \"padding\": \"valid\", \"strides\": [2, 2], \"data_format\": \"channels_last\"}, \"name\": \"pool1_pool\", \"inbound_nodes\": [[[\"pool1_pad\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block1_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block1_1_conv\", \"inbound_nodes\": [[[\"pool1_pool\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block1_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block1_1_bn\", \"inbound_nodes\": [[[\"conv2_block1_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block1_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block1_1_relu\", \"inbound_nodes\": [[[\"conv2_block1_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block1_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block1_2_conv\", \"inbound_nodes\": [[[\"conv2_block1_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block1_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block1_2_bn\", \"inbound_nodes\": [[[\"conv2_block1_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block1_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block1_2_relu\", \"inbound_nodes\": [[[\"conv2_block1_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block1_0_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block1_0_conv\", \"inbound_nodes\": [[[\"pool1_pool\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block1_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block1_3_conv\", \"inbound_nodes\": [[[\"conv2_block1_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block1_0_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block1_0_bn\", \"inbound_nodes\": [[[\"conv2_block1_0_conv\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block1_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block1_3_bn\", \"inbound_nodes\": [[[\"conv2_block1_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv2_block1_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv2_block1_add\", \"inbound_nodes\": [[[\"conv2_block1_0_bn\", 0, 0, {}], [\"conv2_block1_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block1_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block1_out\", \"inbound_nodes\": [[[\"conv2_block1_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block2_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block2_1_conv\", \"inbound_nodes\": [[[\"conv2_block1_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block2_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block2_1_bn\", \"inbound_nodes\": [[[\"conv2_block2_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block2_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block2_1_relu\", \"inbound_nodes\": [[[\"conv2_block2_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block2_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block2_2_conv\", \"inbound_nodes\": [[[\"conv2_block2_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block2_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block2_2_bn\", \"inbound_nodes\": [[[\"conv2_block2_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block2_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block2_2_relu\", \"inbound_nodes\": [[[\"conv2_block2_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block2_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block2_3_conv\", \"inbound_nodes\": [[[\"conv2_block2_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block2_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block2_3_bn\", \"inbound_nodes\": [[[\"conv2_block2_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv2_block2_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv2_block2_add\", \"inbound_nodes\": [[[\"conv2_block1_out\", 0, 0, {}], [\"conv2_block2_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block2_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block2_out\", \"inbound_nodes\": [[[\"conv2_block2_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block3_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block3_1_conv\", \"inbound_nodes\": [[[\"conv2_block2_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block3_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block3_1_bn\", \"inbound_nodes\": [[[\"conv2_block3_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block3_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block3_1_relu\", \"inbound_nodes\": [[[\"conv2_block3_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block3_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 64, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block3_2_conv\", \"inbound_nodes\": [[[\"conv2_block3_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block3_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block3_2_bn\", \"inbound_nodes\": [[[\"conv2_block3_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block3_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block3_2_relu\", \"inbound_nodes\": [[[\"conv2_block3_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv2_block3_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv2_block3_3_conv\", \"inbound_nodes\": [[[\"conv2_block3_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv2_block3_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv2_block3_3_bn\", \"inbound_nodes\": [[[\"conv2_block3_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv2_block3_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv2_block3_add\", \"inbound_nodes\": [[[\"conv2_block2_out\", 0, 0, {}], [\"conv2_block3_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv2_block3_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv2_block3_out\", \"inbound_nodes\": [[[\"conv2_block3_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block1_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block1_1_conv\", \"inbound_nodes\": [[[\"conv2_block3_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block1_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block1_1_bn\", \"inbound_nodes\": [[[\"conv3_block1_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block1_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block1_1_relu\", \"inbound_nodes\": [[[\"conv3_block1_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block1_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block1_2_conv\", \"inbound_nodes\": [[[\"conv3_block1_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block1_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block1_2_bn\", \"inbound_nodes\": [[[\"conv3_block1_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block1_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block1_2_relu\", \"inbound_nodes\": [[[\"conv3_block1_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block1_0_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block1_0_conv\", \"inbound_nodes\": [[[\"conv2_block3_out\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block1_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block1_3_conv\", \"inbound_nodes\": [[[\"conv3_block1_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block1_0_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block1_0_bn\", \"inbound_nodes\": [[[\"conv3_block1_0_conv\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block1_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block1_3_bn\", \"inbound_nodes\": [[[\"conv3_block1_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv3_block1_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv3_block1_add\", \"inbound_nodes\": [[[\"conv3_block1_0_bn\", 0, 0, {}], [\"conv3_block1_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block1_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block1_out\", \"inbound_nodes\": [[[\"conv3_block1_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block2_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block2_1_conv\", \"inbound_nodes\": [[[\"conv3_block1_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block2_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block2_1_bn\", \"inbound_nodes\": [[[\"conv3_block2_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block2_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block2_1_relu\", \"inbound_nodes\": [[[\"conv3_block2_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block2_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block2_2_conv\", \"inbound_nodes\": [[[\"conv3_block2_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block2_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block2_2_bn\", \"inbound_nodes\": [[[\"conv3_block2_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block2_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block2_2_relu\", \"inbound_nodes\": [[[\"conv3_block2_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block2_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block2_3_conv\", \"inbound_nodes\": [[[\"conv3_block2_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block2_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block2_3_bn\", \"inbound_nodes\": [[[\"conv3_block2_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv3_block2_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv3_block2_add\", \"inbound_nodes\": [[[\"conv3_block1_out\", 0, 0, {}], [\"conv3_block2_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block2_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block2_out\", \"inbound_nodes\": [[[\"conv3_block2_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block3_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block3_1_conv\", \"inbound_nodes\": [[[\"conv3_block2_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block3_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block3_1_bn\", \"inbound_nodes\": [[[\"conv3_block3_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block3_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block3_1_relu\", \"inbound_nodes\": [[[\"conv3_block3_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block3_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block3_2_conv\", \"inbound_nodes\": [[[\"conv3_block3_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block3_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block3_2_bn\", \"inbound_nodes\": [[[\"conv3_block3_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block3_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block3_2_relu\", \"inbound_nodes\": [[[\"conv3_block3_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block3_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block3_3_conv\", \"inbound_nodes\": [[[\"conv3_block3_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block3_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block3_3_bn\", \"inbound_nodes\": [[[\"conv3_block3_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv3_block3_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv3_block3_add\", \"inbound_nodes\": [[[\"conv3_block2_out\", 0, 0, {}], [\"conv3_block3_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block3_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block3_out\", \"inbound_nodes\": [[[\"conv3_block3_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block4_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block4_1_conv\", \"inbound_nodes\": [[[\"conv3_block3_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block4_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block4_1_bn\", \"inbound_nodes\": [[[\"conv3_block4_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block4_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block4_1_relu\", \"inbound_nodes\": [[[\"conv3_block4_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block4_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 128, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block4_2_conv\", \"inbound_nodes\": [[[\"conv3_block4_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block4_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block4_2_bn\", \"inbound_nodes\": [[[\"conv3_block4_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block4_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block4_2_relu\", \"inbound_nodes\": [[[\"conv3_block4_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv3_block4_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv3_block4_3_conv\", \"inbound_nodes\": [[[\"conv3_block4_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv3_block4_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv3_block4_3_bn\", \"inbound_nodes\": [[[\"conv3_block4_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv3_block4_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv3_block4_add\", \"inbound_nodes\": [[[\"conv3_block3_out\", 0, 0, {}], [\"conv3_block4_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv3_block4_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv3_block4_out\", \"inbound_nodes\": [[[\"conv3_block4_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block1_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block1_1_conv\", \"inbound_nodes\": [[[\"conv3_block4_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block1_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block1_1_bn\", \"inbound_nodes\": [[[\"conv4_block1_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block1_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block1_1_relu\", \"inbound_nodes\": [[[\"conv4_block1_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block1_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block1_2_conv\", \"inbound_nodes\": [[[\"conv4_block1_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block1_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block1_2_bn\", \"inbound_nodes\": [[[\"conv4_block1_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block1_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block1_2_relu\", \"inbound_nodes\": [[[\"conv4_block1_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block1_0_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block1_0_conv\", \"inbound_nodes\": [[[\"conv3_block4_out\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block1_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block1_3_conv\", \"inbound_nodes\": [[[\"conv4_block1_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block1_0_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block1_0_bn\", \"inbound_nodes\": [[[\"conv4_block1_0_conv\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block1_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block1_3_bn\", \"inbound_nodes\": [[[\"conv4_block1_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block1_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block1_add\", \"inbound_nodes\": [[[\"conv4_block1_0_bn\", 0, 0, {}], [\"conv4_block1_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block1_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block1_out\", \"inbound_nodes\": [[[\"conv4_block1_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block2_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block2_1_conv\", \"inbound_nodes\": [[[\"conv4_block1_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block2_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block2_1_bn\", \"inbound_nodes\": [[[\"conv4_block2_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block2_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block2_1_relu\", \"inbound_nodes\": [[[\"conv4_block2_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block2_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block2_2_conv\", \"inbound_nodes\": [[[\"conv4_block2_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block2_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block2_2_bn\", \"inbound_nodes\": [[[\"conv4_block2_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block2_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block2_2_relu\", \"inbound_nodes\": [[[\"conv4_block2_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block2_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block2_3_conv\", \"inbound_nodes\": [[[\"conv4_block2_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block2_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block2_3_bn\", \"inbound_nodes\": [[[\"conv4_block2_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block2_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block2_add\", \"inbound_nodes\": [[[\"conv4_block1_out\", 0, 0, {}], [\"conv4_block2_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block2_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block2_out\", \"inbound_nodes\": [[[\"conv4_block2_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block3_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block3_1_conv\", \"inbound_nodes\": [[[\"conv4_block2_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block3_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block3_1_bn\", \"inbound_nodes\": [[[\"conv4_block3_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block3_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block3_1_relu\", \"inbound_nodes\": [[[\"conv4_block3_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block3_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block3_2_conv\", \"inbound_nodes\": [[[\"conv4_block3_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block3_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block3_2_bn\", \"inbound_nodes\": [[[\"conv4_block3_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block3_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block3_2_relu\", \"inbound_nodes\": [[[\"conv4_block3_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block3_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block3_3_conv\", \"inbound_nodes\": [[[\"conv4_block3_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block3_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block3_3_bn\", \"inbound_nodes\": [[[\"conv4_block3_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block3_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block3_add\", \"inbound_nodes\": [[[\"conv4_block2_out\", 0, 0, {}], [\"conv4_block3_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block3_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block3_out\", \"inbound_nodes\": [[[\"conv4_block3_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block4_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block4_1_conv\", \"inbound_nodes\": [[[\"conv4_block3_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block4_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block4_1_bn\", \"inbound_nodes\": [[[\"conv4_block4_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block4_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block4_1_relu\", \"inbound_nodes\": [[[\"conv4_block4_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block4_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block4_2_conv\", \"inbound_nodes\": [[[\"conv4_block4_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block4_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block4_2_bn\", \"inbound_nodes\": [[[\"conv4_block4_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block4_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block4_2_relu\", \"inbound_nodes\": [[[\"conv4_block4_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block4_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block4_3_conv\", \"inbound_nodes\": [[[\"conv4_block4_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block4_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block4_3_bn\", \"inbound_nodes\": [[[\"conv4_block4_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block4_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block4_add\", \"inbound_nodes\": [[[\"conv4_block3_out\", 0, 0, {}], [\"conv4_block4_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block4_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block4_out\", \"inbound_nodes\": [[[\"conv4_block4_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block5_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block5_1_conv\", \"inbound_nodes\": [[[\"conv4_block4_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block5_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block5_1_bn\", \"inbound_nodes\": [[[\"conv4_block5_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block5_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block5_1_relu\", \"inbound_nodes\": [[[\"conv4_block5_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block5_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block5_2_conv\", \"inbound_nodes\": [[[\"conv4_block5_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block5_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block5_2_bn\", \"inbound_nodes\": [[[\"conv4_block5_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block5_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block5_2_relu\", \"inbound_nodes\": [[[\"conv4_block5_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block5_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block5_3_conv\", \"inbound_nodes\": [[[\"conv4_block5_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block5_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block5_3_bn\", \"inbound_nodes\": [[[\"conv4_block5_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block5_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block5_add\", \"inbound_nodes\": [[[\"conv4_block4_out\", 0, 0, {}], [\"conv4_block5_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block5_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block5_out\", \"inbound_nodes\": [[[\"conv4_block5_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block6_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block6_1_conv\", \"inbound_nodes\": [[[\"conv4_block5_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block6_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block6_1_bn\", \"inbound_nodes\": [[[\"conv4_block6_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block6_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block6_1_relu\", \"inbound_nodes\": [[[\"conv4_block6_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block6_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 256, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block6_2_conv\", \"inbound_nodes\": [[[\"conv4_block6_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block6_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block6_2_bn\", \"inbound_nodes\": [[[\"conv4_block6_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block6_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block6_2_relu\", \"inbound_nodes\": [[[\"conv4_block6_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv4_block6_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 1024, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv4_block6_3_conv\", \"inbound_nodes\": [[[\"conv4_block6_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv4_block6_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv4_block6_3_bn\", \"inbound_nodes\": [[[\"conv4_block6_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv4_block6_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv4_block6_add\", \"inbound_nodes\": [[[\"conv4_block5_out\", 0, 0, {}], [\"conv4_block6_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv4_block6_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv4_block6_out\", \"inbound_nodes\": [[[\"conv4_block6_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block1_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block1_1_conv\", \"inbound_nodes\": [[[\"conv4_block6_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block1_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block1_1_bn\", \"inbound_nodes\": [[[\"conv5_block1_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block1_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block1_1_relu\", \"inbound_nodes\": [[[\"conv5_block1_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block1_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block1_2_conv\", \"inbound_nodes\": [[[\"conv5_block1_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block1_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block1_2_bn\", \"inbound_nodes\": [[[\"conv5_block1_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block1_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block1_2_relu\", \"inbound_nodes\": [[[\"conv5_block1_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block1_0_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 2048, \"kernel_size\": [1, 1], \"strides\": [2, 2], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block1_0_conv\", \"inbound_nodes\": [[[\"conv4_block6_out\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block1_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 2048, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block1_3_conv\", \"inbound_nodes\": [[[\"conv5_block1_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block1_0_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block1_0_bn\", \"inbound_nodes\": [[[\"conv5_block1_0_conv\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block1_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block1_3_bn\", \"inbound_nodes\": [[[\"conv5_block1_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv5_block1_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv5_block1_add\", \"inbound_nodes\": [[[\"conv5_block1_0_bn\", 0, 0, {}], [\"conv5_block1_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block1_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block1_out\", \"inbound_nodes\": [[[\"conv5_block1_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block2_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block2_1_conv\", \"inbound_nodes\": [[[\"conv5_block1_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block2_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block2_1_bn\", \"inbound_nodes\": [[[\"conv5_block2_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block2_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block2_1_relu\", \"inbound_nodes\": [[[\"conv5_block2_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block2_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block2_2_conv\", \"inbound_nodes\": [[[\"conv5_block2_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block2_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block2_2_bn\", \"inbound_nodes\": [[[\"conv5_block2_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block2_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block2_2_relu\", \"inbound_nodes\": [[[\"conv5_block2_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block2_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 2048, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block2_3_conv\", \"inbound_nodes\": [[[\"conv5_block2_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block2_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block2_3_bn\", \"inbound_nodes\": [[[\"conv5_block2_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv5_block2_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv5_block2_add\", \"inbound_nodes\": [[[\"conv5_block1_out\", 0, 0, {}], [\"conv5_block2_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block2_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block2_out\", \"inbound_nodes\": [[[\"conv5_block2_add\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block3_1_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block3_1_conv\", \"inbound_nodes\": [[[\"conv5_block2_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block3_1_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block3_1_bn\", \"inbound_nodes\": [[[\"conv5_block3_1_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block3_1_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block3_1_relu\", \"inbound_nodes\": [[[\"conv5_block3_1_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block3_2_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 512, \"kernel_size\": [3, 3], \"strides\": [1, 1], \"padding\": \"same\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block3_2_conv\", \"inbound_nodes\": [[[\"conv5_block3_1_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block3_2_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block3_2_bn\", \"inbound_nodes\": [[[\"conv5_block3_2_conv\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block3_2_relu\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block3_2_relu\", \"inbound_nodes\": [[[\"conv5_block3_2_bn\", 0, 0, {}]]]}, {\"class_name\": \"Conv2D\", \"config\": {\"name\": \"conv5_block3_3_conv\", \"trainable\": true, \"dtype\": \"float32\", \"filters\": 2048, \"kernel_size\": [1, 1], \"strides\": [1, 1], \"padding\": \"valid\", \"data_format\": \"channels_last\", \"dilation_rate\": [1, 1], \"groups\": 1, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"conv5_block3_3_conv\", \"inbound_nodes\": [[[\"conv5_block3_2_relu\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"conv5_block3_3_bn\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [3], \"momentum\": 0.99, \"epsilon\": 1.001e-05, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"conv5_block3_3_bn\", \"inbound_nodes\": [[[\"conv5_block3_3_conv\", 0, 0, {}]]]}, {\"class_name\": \"Add\", \"config\": {\"name\": \"conv5_block3_add\", \"trainable\": true, \"dtype\": \"float32\"}, \"name\": \"conv5_block3_add\", \"inbound_nodes\": [[[\"conv5_block2_out\", 0, 0, {}], [\"conv5_block3_3_bn\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"conv5_block3_out\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"conv5_block3_out\", \"inbound_nodes\": [[[\"conv5_block3_add\", 0, 0, {}]]]}, {\"class_name\": \"GlobalAveragePooling2D\", \"config\": {\"name\": \"avg_pool\", \"trainable\": true, \"dtype\": \"float32\", \"data_format\": \"channels_last\"}, \"name\": \"avg_pool\", \"inbound_nodes\": [[[\"conv5_block3_out\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"batch_normalization\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [1], \"momentum\": 0.99, \"epsilon\": 0.001, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"batch_normalization\", \"inbound_nodes\": [[[\"avg_pool\", 0, 0, {}]]]}, {\"class_name\": \"Flatten\", \"config\": {\"name\": \"flatten\", \"trainable\": true, \"dtype\": \"float32\", \"data_format\": \"channels_last\"}, \"name\": \"flatten\", \"inbound_nodes\": [[[\"batch_normalization\", 0, 0, {}]]]}, {\"class_name\": \"Dense\", \"config\": {\"name\": \"dense\", \"trainable\": true, \"dtype\": \"float32\", \"units\": 1024, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"dense\", \"inbound_nodes\": [[[\"flatten\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"activation\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"relu\"}, \"name\": \"activation\", \"inbound_nodes\": [[[\"dense\", 0, 0, {}]]]}, {\"class_name\": \"BatchNormalization\", \"config\": {\"name\": \"batch_normalization_1\", \"trainable\": true, \"dtype\": \"float32\", \"axis\": [1], \"momentum\": 0.99, \"epsilon\": 0.001, \"center\": true, \"scale\": true, \"beta_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"gamma_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"moving_mean_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"moving_variance_initializer\": {\"class_name\": \"Ones\", \"config\": {}}, \"beta_regularizer\": null, \"gamma_regularizer\": null, \"beta_constraint\": null, \"gamma_constraint\": null}, \"name\": \"batch_normalization_1\", \"inbound_nodes\": [[[\"activation\", 0, 0, {}]]]}, {\"class_name\": \"Dense\", \"config\": {\"name\": \"dense_1\", \"trainable\": true, \"dtype\": \"float32\", \"units\": 49, \"activation\": \"linear\", \"use_bias\": true, \"kernel_initializer\": {\"class_name\": \"GlorotUniform\", \"config\": {\"seed\": null}}, \"bias_initializer\": {\"class_name\": \"Zeros\", \"config\": {}}, \"kernel_regularizer\": null, \"bias_regularizer\": null, \"activity_regularizer\": null, \"kernel_constraint\": null, \"bias_constraint\": null}, \"name\": \"dense_1\", \"inbound_nodes\": [[[\"batch_normalization_1\", 0, 0, {}]]]}, {\"class_name\": \"Activation\", \"config\": {\"name\": \"activation_1\", \"trainable\": true, \"dtype\": \"float32\", \"activation\": \"softmax\"}, \"name\": \"activation_1\", \"inbound_nodes\": [[[\"dense_1\", 0, 0, {}]]]}], \"input_layers\": [[\"input_1\", 0, 0]], \"output_layers\": [[\"activation_1\", 0, 0]]}, \"keras_version\": \"2.4.0\", \"backend\": \"tensorflow\"}'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "json_config = model.to_json()\n",
    "json_config"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('../../data/neural_networks/Car_ResNet50.json', 'w') as json_file:\n",
    "    json_file.write(json_config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "75"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "grad",
   "language": "python",
   "name": "grad"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
